package com.nx.edu;

import lombok.AllArgsConstructor;

/**
 * @author Fxz
 * @version 1.0
 * @date 2021-08-12 8:56
 */
@AllArgsConstructor
public class NxSqlSession {

    private NxConfiguration nxConfiguration;
    private NxExecutor nxExecutor;

    public <T> T getMapper(Class mapperClass) {
        return nxConfiguration.getMapper(mapperClass, this);
    }

    public Object selectOne(String statementId, Object arg) {
        String sql = nxConfiguration.getSqlMap().getString(statementId);
        return nxExecutor.query(sql, arg);
    }
}
